package org.expressme.employee.mgmt;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

/**
 * RowMapper for Employee.
 * 
 * @author Michael Liao (askxuefeng@gmail.com)
 */
public class EmployeeRowMapper implements RowMapper {

    public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
        
    	Employee employee = new Employee();
        
    	employee.setId(rs.getString("id"));
        
    	employee.setName(rs.getString("name"));
        
    	employee.setTitle(rs.getString("title"));
        
    	employee.setGender(rs.getBoolean("gender"));
        
    	employee.setBirth(rs.getDate("birth"));
        
    	return employee;
    }

}
